# 用来生成发布文件
import shutil,os

def ignore(path,dirs):
    if path=='./':
        return [i for i in dirs if (i in ignoreList)]
    return []

with open('.buildignore','r',encoding='utf8') as f:
    ignoreList=f.read().split('\n')

if os.path.exists('build'):
    shutil.rmtree('build')
shutil.copytree('./','build',ignore=ignore)
shutil.make_archive('build','zip','build')
shutil.rmtree('build')